﻿using System;
using SlamCms.Web;

namespace SlamCms.Data
{
	public static class QueryResultExtensions
	{
		public static Pager ToPager<T>(this QueryPagedResult<T> slamQueryPagedResult, Func<int, string> urlResolver) where T : ContentItem
		{
			return new Pager()
			{
				UrlResolver = urlResolver,
				TotalCount = slamQueryPagedResult.TotalCount,
				TotalPages = slamQueryPagedResult.TotalPages,
				PageNumber = slamQueryPagedResult.PageNumber,
				PageSize = slamQueryPagedResult.PageSize
			};
		}
	}
}
